package main

func main() {

}

// 二叉树的中序遍历
func inordertraversal(root *TreeNode) []int {

	vals := []int{}

	var inorder func(node *TreeNode)

	inorder = func(node *TreeNode) {

		if node == nil {
			return
		}

		inorder(node.Left)
		vals = append(vals, node.Val)
		inorder(node.Right)
	}

	inorder(root)

	return vals

}

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}
